package com.xsq.utils;

import android.content.Context;

import org.json.JSONObject;

public class StatusUtils {

	public static void handleStatus(JSONObject response, Context context) {
		ToastUtil.showShort(context, response.optString("msg", "返回状态错误"));
	}

	public static void handleMsg(JSONObject response, Context context) {
		ToastUtil.showShort(context, response.optString("msg", "返回状态错误"));
	}

	public static void handleError(Throwable err, Context context) {
		err.printStackTrace();
		/*if (err instanceof TimeoutError) {
			ToastUtil.showShort(context, "请求超时");
			return;
		} else if (err instanceof com.android.volley.NoConnectionError) {
			ToastUtil.showShort(context, "网络异常");
			return;
		}*/

		ToastUtil.showShort(context, "连接服务器错误");
		err.printStackTrace();
	}

	public static void handleOtherError(String err, Context context) {
		ToastUtil.showShort(context, err);
	}

}
